package com.comac.print.component.app.gatewayimpl.database.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.comac.print.component.app.dto.MasterPlateDTO;
import com.comac.print.component.app.dto.SystemDTO;
import com.comac.print.component.app.gatewayimpl.database.dataobject.MasterPlateDO;
import com.comac.print.component.app.gatewayimpl.database.dataobject.SystemDO;
import com.comac.print.component.app.qry.MasterPlateListQry;
import com.comac.print.component.app.qry.SystemListQry;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 模板表 Mapper 接口
 * </p>
 *
 * @author yy
 * @since 2022-04-08
 */
public interface SystemMapper extends BaseMapper<SystemDO> {
    @Select("<script>" +
            "select " +
            "s.ID as stId, " +
            "s.SYSTEM_NAME as systemName, " +
            "s.SYSTEM_NO as systemNo, " +
            "s.SYSTEM_AK as systemAk, " +
            "s.STATUS as status, " +
            "s.CREATOR as creator, " +
            "s.CREATE_TIME as createTime " +
            "from " +
            "	print_sign s " +
            "<where> " +
            "<if test=\"qry.systemName != null and qry.systemName != ''\">" +
            "     and s.SYSTEM_NAME like concat('%',#{qry.systemName},'%')" +
            "</if>" +
            "<if test=\"qry.systemNo != null and qry.systemNo != ''\">" +
            "     and s.SYSTEM_NO = #{qry.systemNo}" +
            "</if>" +
            "<if test=\"qry.stId != null and qry.stId != ''\">" +
            "     and s.ID = #{qry.stId}" +
            "</if>" +
            "<if test=\"qry.systemNo != null and qry.systemNo != ''\">" +
            "     and s.SYSTEM_NO like concat('%',#{qry.systemNo},'%')" +
            "</if>" +
            "<if test=\"qry.status != null and qry.status != ''\">" +
            "     and s.STATUS = #{qry.status}" +
            "</if>" +
            "   and s.DELETE_FLAG = 0 " +
            "</where> " +
            "</script>")
    Page<SystemDTO> qrySystemList(Page page, @Param("qry") SystemListQry qry);

}
